<!DOCTYPE html>
<html lang="en">
<head>
    {include file='public/header' /}
    <!-- Bootstrap Dropify CSS -->
    <link href="__PUBLIC__/admin/vendors/bower_components/dropify/dist/css/dropify.min.css" rel="stylesheet" type="text/css"/>

    <!-- Bootstrap Datetimepicker CSS -->
    <link href="__PUBLIC__/admin/vendors/bower_components/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css"/>

    <link href="__PUBLIC__/admin/vendors/file_input/css/fileinput.css" rel="stylesheet" type="text/css"/>
    <link href="__PUBLIC__/admin/vendors/file_input/themes/explorer-fa/theme.css" media="all" rel="stylesheet" type="text/css"/>

    <!-- Custom CSS -->
    {include file='public/comn_css' /}
</head>
<body>
<!--Preloader-->
<div class="preloader-it">
    <div class="la-anim-1"></div>
</div>
<!--/Preloader-->
<div class="wrapper  theme-5-active pimary-color-blue">

    <!-- Top Menu Items -->
    {include file='public/top_menu' /}
    <!-- /Top Menu Items -->

    <!-- Left Sidebar Menu -->
    {include file='public/sidebar' /}
    <!-- /Left Sidebar Menu -->

    <!-- Main Content -->
    <div class="page-wrapper">
        <div class="container-fluid">
            <!-- Title -->
            <div class="row heading-bg">
                <div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
                    <h5 class="txt-dark">列表信息</h5>
                </div>
                <!-- Breadcrumb -->
                <div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
                    <ol class="breadcrumb">
                        <li><a href="{:url('admin/index/index')}">系统首页</a></li>
                        <li><a href="{:url('admin/article/index')}">列表信息</a></li>
                        <li class="active"><span>修改文章</span></li>
                    </ol>
                </div>
                <!-- /Breadcrumb -->
            </div>
            <!-- /Title -->

            <!-- Row -->
            <div class="row">
                <div class="col-lg-12 col-sm-12">
                    <div class="panel panel-default card-view">
                        <div class="panel-wrapper collapse in">
                            <div class="panel-body">
                                <form class="form-horizontal" id="system_form" method="post" action="{:url('doEdit')}" enctype="multipart/form-data">
                                    <input type="hidden" name="id" value="{$info.id}">
                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2" for="category_id">所属分类:</label>
                                        <div class="col-sm-8">
                                            <select name="category_id" id="category_id" class="form-control" required>
                                                {notempty name='list'}
                                                {foreach name='list' item='value'}
                                                <option value="{$value.id}" {eq name="info.category_id" value="$value['id']"}selected="selected"{/eq} {eq name="value.attr" value="1"}disabled="disabled"{/eq} {eq name="value.type" value="2"}disabled="disabled"{/eq} >
                                                {notempty name='value.parentid'}
                                                {for start="0" end="$value._level-1" step="1" name="i" }
                                                &nbsp;&nbsp;
                                                {/for}
                                                └
                                                {/notempty}
                                                {$value.title}
                                                </option>
                                                {/foreach}
                                                {/notempty}
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2" for="title">文章标题:</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" id="title" name="title" placeholder="请输入 文章标题" value="{$info.title}" required>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2">文章属性</label>
                                        <div class="col-sm-8">
                                            <div class="checkbox col-sm-2">
                                                <input id="checkbox1" type="checkbox" name="attr[]" value="h" {if condition="!empty($info['attr']) && in_array('h', $info['attr'])"}checked=""{/if}>
                                                <label for="checkbox1">
                                                    头条[h]
                                                </label>
                                            </div>
                                            <div class="checkbox col-sm-2">
                                                <input id="checkbox2" type="checkbox" name="attr[]" value="r" {if condition="!empty($info['attr']) && in_array('r', $info['attr'])"}checked=""{/if}>
                                                <label for="checkbox2">
                                                    推荐[r]
                                                </label>
                                            </div>
                                            <div class="checkbox col-sm-2">
                                                <input id="checkbox3" type="checkbox" name="attr[]" value="s" {if condition="!empty($info['attr']) && in_array('s', $info['attr'])"}checked=""{/if}>
                                                <label for="checkbox3">
                                                    幻灯[s]
                                                </label>
                                            </div>
                                            <div class="checkbox col-sm-2">
                                                <input id="checkbox4" type="checkbox" name="attr[]" value="m" {if condition="!empty($info['attr']) && in_array('m', $info['attr'])"}checked=""{/if}>
                                                <label for="checkbox4">
                                                    滚动[m]
                                                </label>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2" for="other_title">副标题:</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" id="other_title" name="other_title" placeholder="请输入 副标题" value="{$info.other_title}">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2" for="thumb">缩略图:</label>
                                        <div class="col-sm-8">
                                            <input type="file" name="thumb" id="thumb" data-max-file-size="{$Think.config.img_size}M" data-max-file-size-preview="{$Think.config.img_size}M" data-allowed-file-extensions="{$Think.config.img_type}" data-errors-position="outside" class="dropify" {notempty name="info.thumb"}data-default-file="__PUBLIC__/{$info.thumb}"{/notempty} />
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2"></label>
                                        <div class="checkbox col-sm-8">
                                            <input type="checkbox" name="thumb_del" value="1" id="thumb_del" style="position: unset;margin-left: 0;">
                                            <label for="thumb_del">
                                                删除缩略图
                                            </label>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2" for="keywords">关键字:</label>
                                        <div class="col-sm-8">
                                            <textarea name="keywords" id="keywords" cols="30" class="form-control" rows="5">{$info.keywords}</textarea>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2" for="description">描述:</label>
                                        <div class="col-sm-8">
                                            <textarea name="description" id="description" cols="30" class="form-control" rows="5">{$info.description}</textarea>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2" for="author">作者:</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" id="author" name="author" placeholder="请输入 作者" value="{$info.author}">
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2" for="source">来源:</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" id="source" name="source" placeholder="请输入 来源" value="{$info.source}">
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2" for="hits">点击量:</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" id="hits" name="hits" placeholder="请输入 点击量" value="{$info.hits}">
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2" for="content">内容:</label>
                                        <div class="col-sm-8">
                                            <textarea name="content" id="content" cols="30" class="form-control" rows="10">{$info.content|htmlspecialchars_decode}</textarea>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2" for="photos">图集:</label>
                                        {notempty name='info.photos'}
                                        <div class="col-sm-8">
                                            <div class="panel panel-default card-view">
                                                <div class="panel-wrapper collapse in">
                                                    <div class="panel-body pl-15">
                                                        <ol>
                                                            {foreach name='info.photos' item='value'}
                                                            <li class="mb-10"><a href="__PUBLIC__/{$value.path}" data-toggle="tooltip" title="点击查看原图" title="点击查看原图" target="_blank">{$value.name}</a></li>
                                                            {/foreach}
                                                        </ol>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        {/notempty}
                                        <div class="col-sm-8 {notempty name='info.photos'}col-sm-offset-2{/notempty}">
                                            <input type="file" name="photos[]" id="photos" multiple>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2"></label>
                                        <div class="checkbox col-sm-8">
                                            <input type="checkbox" name="photos_del" value="1" id="photos_del" style="position: unset;margin-left: 0;">
                                            <label for="thumb_del">
                                                清空图集
                                            </label>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2" for="enclosure">附件:</label>
                                        {notempty name='info.enclosure'}
                                        <div class="col-sm-8">
                                            <div class="panel panel-default card-view">
                                                <div class="panel-wrapper collapse in">
                                                    <div class="panel-body pl-15">
                                                        <ol>
                                                            {foreach name='info.enclosure' item='value'}
                                                            <li class="mb-10"><a href="__PUBLIC__/{$value.path}" data-toggle="tooltip" title="点击下载附件" title="点击下载附件" target="_blank">{$value.name}</a></li>
                                                            {/foreach}
                                                        </ol>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        {/notempty}
                                        <div class="col-sm-8 {notempty name='info.enclosure'}col-sm-offset-2{/notempty}">
                                            <input type="file" name="enclosure[]" id="enclosure" multiple>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2"></label>
                                        <div class="checkbox col-sm-8">
                                            <input type="checkbox" name="enclosure_del" value="1" id="enclosure_del" style="position: unset;margin-left: 0;">
                                            <label for="thumb_del">
                                                清空附件
                                            </label>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2" for="sort">排序:</label>
                                        <div class="col-sm-8">
                                            <input type="number" class="form-control" id="sort" name="sort" placeholder="请输入 排序" value="{$info.sort}" required >
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2" for="is_top">置顶天数:</label>
                                        <div class="col-sm-8">
                                            <select name="is_top" id="is_top" class="form-control">
                                                <option value="0" {eq name="info.is_top" value="0"}selected=""{/eq}>普通文章</option>
                                                <option value="7" {eq name="info.is_top" value="7"}selected=""{/eq}>置顶一周</option>
                                                <option value="30" {eq name="info.is_top" value="30"}selected=""{/eq}>置顶一个月</option>
                                                <option value="90" {eq name="info.is_top" value="90"}selected=""{/eq}>置顶三个月</option>
                                                <option value="180" {eq name="info.is_top" value="180"}selected=""{/eq}>置顶半年</option>
                                                <option value="365" {eq name="info.is_top" value="365"}selected=""{/eq}>置顶一年</option>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2" for="tpl">模版选择:</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" id="tpl" name="tpl" placeholder="栏目默认模版" value="{$info.tpl}">
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label mb-10 col-sm-2">状态</label>
                                        <div class="col-sm-8">
                                            <div class="radio radio-info">
                                                <input type="radio" name="status" id="radio3" value="1" {eq name="info.status" value="1"}checked=""{/eq}>
                                                <label for="radio3">
                                                    审核通过
                                                </label>
                                            </div>
                                            <div class="radio radio-info">
                                                <input type="radio" name="status" id="radio4" value="2" {eq name="info.status" value="2"}checked=""{/eq}>
                                                <label for="radio3">
                                                    审核不通过
                                                </label>
                                            </div>
                                            <div class="radio radio-info">
                                                <input type="radio" name="status" id="radio5" value="0" {eq name="info.status" value="0"}checked=""{/eq}>
                                                <label for="radio4">
                                                    未审核
                                                </label>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-sm-offset-2 col-sm-10">
                                            <button type="submit" class="btn btn-success"><span class="btn-text">提交</span></button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /Row -->

        </div>
        <!-- Footer -->
        {include file='public/footer' /}
        <!-- /Footer -->

    </div>
    <!-- /Main Content -->

</div>
<!-- /#wrapper -->

<!-- JavaScript -->
<script charset="utf-8" src="__PUBLIC__/admin/vendors/kindeditor/kindeditor-all.js"></script>
<script charset="utf-8" src="__PUBLIC__/admin/vendors/kindeditor/lang/zh-CN.js"></script>
<script>
    KindEditor.ready(function(K) {
        window.editor = K.create('#content', {
            width : '100%'
        });
    });
</script>
<!-- jQuery -->
<script src="__PUBLIC__/admin/vendors/bower_components/jquery/dist/jquery.min.js"></script>

<!-- Bootstrap Core JavaScript -->
<script src="__PUBLIC__/admin/vendors/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

<script src="__PUBLIC__/admin/vendors/file_input/js/fileinput.js" type="text/javascript"></script>
<script src="__PUBLIC__/admin/vendors/file_input/js/locales/zh.js" type="text/javascript"></script>
<script>
    var imgsize  = parseInt('{$Think.config.img_size}')*1024;
    var softsize = parseInt('{$Think.config.soft_size}')*1024;
    $('#photos').fileinput({
        language: 'zh', //设置语言
        showUpload: false,
        showClose: false,
        maxFileSize:imgsize,
        maxFileCount:10,
        enctype: 'multipart/form-data',
        showCancel: false,
        allowedFileExtensions: {$Think.config.img_type|explode=' ', ###|json_encode}
    });

    $('#enclosure').fileinput({
        language: 'zh', //设置语言
        showUpload: false,
        showClose: false,
        maxFileSize:softsize,
        maxFileCount:10,
        enctype: 'multipart/form-data',
        showCancel: false,
        allowedFileExtensions: {$Think.config.soft_type|explode=' ', ###|json_encode}
    });
</script>
<!-- Moment JavaScript -->
<script type="text/javascript" src="__PUBLIC__/admin/vendors/bower_components/moment/min/moment-with-locales.min.js"></script>

<!-- Bootstrap Datetimepicker JavaScript -->
<script type="text/javascript" src="__PUBLIC__/admin/vendors/bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
<script>
    $('#start_time,#end_time').datetimepicker({
        format:'YYYY/MM/DD H:mm',
        useCurrent: false,
        icons: {
            time: "fa fa-clock-o",
            date: "fa fa-calendar",
            up: "fa fa-arrow-up",
            down: "fa fa-arrow-down"
        }
    }).on('dp.show', function() {
        if($(this).data("DateTimePicker").date() === null)
            $(this).data("DateTimePicker").date(moment());
    });
</script>

<!-- Bootstrap Daterangepicker JavaScript -->
<script src="__PUBLIC__/admin/vendors/bower_components/dropify/dist/js/dropify.js"></script>
<script>
    $('.dropify').dropify({
        messages: {
            'default': '拖拽文件或点击',
            'replace': '拖拽或点击覆盖',
            'remove':  '移除',
            'error':   '文件添加错误'
        },
        error: {
            'fileSize': '文件太大 (最大 {{ value }}).',
            'minWidth': '图片宽度太小 (最小 {{ value }}}px).',
            'maxWidth': '图片宽度太大 (最大 {{ value }}}px).',
            'minHeight': '图片高度太小 (最小 {{ value }}}px).',
            'maxHeight': '图片高度太大 (最大 {{ value }}px).',
            'imageFormat': '不被允许图片格式 (允许 {{ value }}).',
            'fileExtension': '非法文件 (允许 {{ value }}).'
        },
    });
</script>
<!-- Form Flie Upload Data JavaScript -->
<!--<script src="__PUBLIC__/admin/dist/js/form-file-upload-data.js"></script>-->

<!-- Slimscroll JavaScript -->
<script src="__PUBLIC__/admin/dist/js/jquery.slimscroll.js"></script>

<!-- Fancy Dropdown JS -->
<script src="__PUBLIC__/admin/dist/js/dropdown-bootstrap-extended.js"></script>

<!-- Owl JavaScript -->
<script src="__PUBLIC__/admin/vendors/bower_components/owl.carousel/dist/owl.carousel.min.js"></script>

<!-- Switchery JavaScript -->
<script src="__PUBLIC__/admin/vendors/bower_components/switchery/dist/switchery.min.js"></script>

<!-- Init JavaScript -->
{include file='public/comn_js' /}

<script src="__PUBLIC__/admin/dist/js/jquery.form.js"></script>
<script src="__PUBLIC__/admin/vendors/layer/layer.js"></script>
<script>
    $('#system_form').submit(function() {
        var index;
        // submit the form
        $(this).ajaxSubmit({
            data:{
                content: editor.html()
            },
            beforeSubmit: function () {
                index = layer.load(1, {shade:[0.6, '#000']});
            },
            success: function (responseText, statusText) {
                if (responseText.status)
                {
                    layer.msg('修改成功！', {shade: [0.6, '#000'], time:3000}, function () {
                        window.location.reload();
                    });
                } else {
                    layer.msg(responseText.msg, {shade: [0.6, '#000'], time:3000}, function () {
                        $('#system_form')[0].reset();
                    });
                }
            }
        });
        // return false to prevent normal browser submit and page navigation
        return false;
    });
</script>
</body>
</html>